package com.svo.md.service.impl;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

import com.svo.md.bean.InviteEntity;
import com.svo.md.service.InviteService;

public class InviteServiceBean implements InviteService {
	/**
	 * 数据源
	 */
	private DataSource dataSource;
	/**
	 * spring提供的jdbc操作辅助类
	 */
	private JdbcTemplate jdbcTemplate;

	// 设置数据源
	public void setDataSource(DataSource dataSource) {
		this.jdbcTemplate = new JdbcTemplate(dataSource);
	}

	@Override
	public void save(InviteEntity entity) {
		jdbcTemplate.update("insert ignore into md_invite(mainId,inviteId,time)values(?,?,?)",
                new Object[] { entity.getMainId(), entity.getInviteId(),entity.getTime()}, 
                new int[] { java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.TIMESTAMP});
	
	}

	@Override
	public void update(InviteEntity entity) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public InviteEntity getSecret(String mainId) {
		// TODO Auto-generated method stub
		return null;
	}

}
